Greetings,
string lstArray [] = {}
DB userInfo
DBE lstUser
DBE lblInstructions
User u
string uName
string uEmail
string uPhone
string uClock
string dbName = getDatabaseName()
/************* Get Current DOORS User List *************/
void getList ()
{
int i = 0
int j
int pbNum = 0
for u in userList do
pbNum ++
progressStart(userInfo, "User Information Progress", "Loading User Info...", pbNum)
j = pbNum
pbNum = 0
for u in userList do
{
uName = u.name
uEmail = u.email
uPhone = u.telephone
uClock = u.systemLoginName
bool isDisabled = u.disabled
if(!isDisabled)
{
insert(lstUser, i, uName, iconUser)
set(lstUser, i, 1, uEmail)
set(lstUser, i, 2, uClock)
set(lstUser, i++, 3, uPhone)
} else
{
insert(lstUser, i, uName, iconUserDisabled)
set(lstUser, i, 1, uEmail)
set(lstUser, i, 2, uClock)
set(lstUser, i++, 3, uPhone)
}
progressStep ++pbNum
progressMessage(pbNum " out of " j "")
if(progressCancelled)
{
if(confirm("Exit loop?"))
{
progressStop
halt
}
}
}
progressStop
}
/************* Print User Info *************/
void doSelect(DBE Elem, int i)
{
""
}
void doDeselect(DBE Elem, int i)
{
""
}
void doActivate(DBE Elem, int i)
{
""
}
/************* Dialog Box *************/
userInfo = create("Find User Info - " dbName"", styleCentered|styleFixed)
lstUser = listView(userInfo, 0, 625, 10, lstArray)
lblInstructions = label(userInfo, "Note: Double-Click on any name to get the user details.")
realize(userInfo)
insertColumn(lstUser, 0, "Username", 150, iconNone)
insertColumn(lstUser, 1, "Email", 150, iconNone)
insertColumn(lstUser, 2, "Login", 150, iconNone)
insertColumn(lstUser, 3, "Telephone", 150, iconNone)
getList()
//set(lstUser, doSelect, doDeselect, doActivate)
show(userInfo)
SystemAdmin - Mon Nov 09 09:48:38 EST 2009 |
Re: First Time Run (Super Slow) The first thing I would suggest is to remove the line: progressMessage(pbNum " out of " j "") Updating the progressbar message really takes a hit on performance. In fact, unless you really need the progressbar you should remove it all together. You have to loop through the user list once just to get the count of users. I'm not really sure why it would take that long to run this script (Even with the processbar) I have over 700 users in my system and it only takes about 3 seconds for the dialog box to load (without updating the progressbar with the line above). Although, I am using an extremenly fast workstation. |
Re: First Time Run (Super Slow) Doug.Zawacki - Mon Nov 09 11:22:24 EST 2009 There may have been an improvement without the Progress stuff. Well, I sure learned something practicing with this. I issued a 'loadDirectory()' first hoping it would speed things up. Nope, still slow. However, the 2nd time I ran it it was STILL slow, seemed to go to the server. I tentatively conclude then, that 'loadDirectory()' doesn't actually load anything, it just marks whatever user info you have on your client as obsolete, and any changes lost.
|
Re: First Time Run (Super Slow) llandale - Mon Nov 09 18:40:13 EST 2009
I already observed this fact years ago with DOORS 7 and previous. At this time, there was a bug in the GUI, as it loaded every single user each time you opened the "Manage users" interface. It was very anoying, because we didn't need to refresh "e-mail" or other property info just to edit a group. At this time, I rewrote the "manage group" window entirely only to cope with this bug. It was fixed with DOORS 8, but loading user records is still a very long operation. (Fixing the bug was loading each user only when necessary, not loading faster.) Btw, in most previous DOORS versions, you needed to saveDirectory before you could loadDirectory. (I received segmentation faults while trying to loadDirectory twice, and it seemed DOORS init sequence contained one loadDirectory). |
Re: First Time Run (Super Slow) ePiallat - Tue Nov 10 05:37:55 EST 2009 If i open the tool to delete multiple users one by one, at some point it will not delete the user internally. I'm using the loadDirectory() and deleteUser(u) and saveDirectory() every time. Does this matter if use repetedly? I'm so confused and angry. If anyone have an idea, welcome. |
Re: First Time Run (Super Slow) SystemAdmin - Tue Aug 17 17:14:35 EDT 2010 |
Re: First Time Run (Super Slow) llandale - Mon Nov 09 18:40:13 EST 2009
Thanks in advance. |
Re: First Time Run (Super Slow) SystemAdmin - Mon Oct 11 08:56:26 EDT 2010 Have you tried using the ensureUserRecordLoaded() before deleting the user record? string ensureUserRecordLoaded(User user) |
Re: First Time Run (Super Slow) SystemAdmin - Mon Oct 11 08:56:26 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: First Time Run (Super Slow) Mathias Mamsch - Tue Oct 12 20:04:36 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS What a hard time this is giving me... I tried what you guys told me, but I keep getting the error. Can anyone try and find out what could be the problem. I need to use this method to delete users. If you see there is a Users Log module, which I use to store all the user information and keep it there just in case i delete the wrong user. Very necessary for me also. Some help would be really appreciated. As I said this method is the one i need since i received a bulk of users to be deleted.
//Delete User Example
string lstArray [] = {}
DB userInfo
DBE lstUser, btnDeleteUser
User u
string uName
string mName = "/DOORS Admin/Users Log/Users Log"
//Module usersModule = edit(mName, false)
string dbName = getDatabaseName()
Skip uList
Skip inUsers
void getList (){
int i = 0
int j
int pbNum = 0
uList = createString()
for u in userList do {
uName = u.name
put(uList, uName, uName)
}
deleteColumn(lstUser, 0)
for uName in uList do{
u = find(uName)
bool isDisabled = u.disabled
if(!isDisabled) {
insert(lstUser, i++, uName, iconUser)
}
else{
insert(lstUser, i++, uName, iconUserDisabled)
}
}
insertColumn(lstUser, 0, "Username", 150, iconNone)
}// End GetList Function (Actual User in Database)
void delUser(DBE Elem){
{
string uName = get(lstUser)
string uGroups
lastPos = get(lstUser)
User u = find(uName)
uName = u.name
if(existsUser(uName)){
if(confirm("Are you sure you want to delete '" uName "' ?")){
if(confirm("Deleting an user is irreversible.\nAre you sure you want to delete '"uName"' ?")){
/*current = usersModule
Object o
Filter f1 = attribute"Username"==uName
set f1
filtering on
o = current
if(!null o){
o."Active (T/F)" = "False"
o."Deletion Date" = today()
//Reason for Deletion Message Box
string options[] = {"Termination", "Inactivity"}
int ans = messageBox("Select Reason for Deletion", options, msgInfo)
o."Reason" = options[ans]
Group g
Buffer temp = create(1)
for g in groupList do{
if(member(g, u)){
uGroups = g.name
temp += uGroups"\n"
}
}
o."Groups" = temp""
save(usersModule)
refresh(usersModule)
}
else if(!confirm("User not found in log.\nDo you want to continue with deletion?")){
return
}*/
loadDirectory()
ensureUserRecordLoaded(u)
string error = deleteUser(u)
saveDirectory()
empty(lstUser)
getList()
if((null error)&&(!existsUser(uName))){
infoBox uName" has been deleted permanently."
}
else{
ack "User not deleted: " error
/*o."Active (T/F)" = "True"
o."Deletion Date" = ""
o."Reason" = ""
save(usersModule)
refresh(usersModule)*/
}
}
else {
ack"Abort Deletion"
halt
}
}
else {
ack"Abort Deletion"
halt
}
}
else {
infoBox"User Not found"
}
}
flushDeletions()
} // End Delete User
userInfo = create("Manage Users Tool - " dbName" v. 1.0", styleCentered|styleFixed)
lstUser = listView(userInfo, listViewOptionMultiselect|listViewOptionSortText, 625, 10, lstArray)
btnDeleteUser = button(userInfo, "Delete User", delUser)
realize(userInfo)
getList()
show(userInfo)
|
Re: First Time Run (Super Slow) SystemAdmin - Wed Oct 13 11:04:03 EDT 2010 What a hard time this is giving me... I tried what you guys told me, but I keep getting the error. Can anyone try and find out what could be the problem. I need to use this method to delete users. If you see there is a Users Log module, which I use to store all the user information and keep it there just in case i delete the wrong user. Very necessary for me also. Some help would be really appreciated. As I said this method is the one i need since i received a bulk of users to be deleted.
//Delete User Example
string lstArray [] = {}
DB userInfo
DBE lstUser, btnDeleteUser
User u
string uName
string mName = "/DOORS Admin/Users Log/Users Log"
//Module usersModule = edit(mName, false)
string dbName = getDatabaseName()
Skip uList
Skip inUsers
void getList (){
int i = 0
int j
int pbNum = 0
uList = createString()
for u in userList do {
uName = u.name
put(uList, uName, uName)
}
deleteColumn(lstUser, 0)
for uName in uList do{
u = find(uName)
bool isDisabled = u.disabled
if(!isDisabled) {
insert(lstUser, i++, uName, iconUser)
}
else{
insert(lstUser, i++, uName, iconUserDisabled)
}
}
insertColumn(lstUser, 0, "Username", 150, iconNone)
}// End GetList Function (Actual User in Database)
void delUser(DBE Elem){
{
string uName = get(lstUser)
string uGroups
lastPos = get(lstUser)
User u = find(uName)
uName = u.name
if(existsUser(uName)){
if(confirm("Are you sure you want to delete '" uName "' ?")){
if(confirm("Deleting an user is irreversible.\nAre you sure you want to delete '"uName"' ?")){
/*current = usersModule
Object o
Filter f1 = attribute"Username"==uName
set f1
filtering on
o = current
if(!null o){
o."Active (T/F)" = "False"
o."Deletion Date" = today()
//Reason for Deletion Message Box
string options[] = {"Termination", "Inactivity"}
int ans = messageBox("Select Reason for Deletion", options, msgInfo)
o."Reason" = options[ans]
Group g
Buffer temp = create(1)
for g in groupList do{
if(member(g, u)){
uGroups = g.name
temp += uGroups"\n"
}
}
o."Groups" = temp""
save(usersModule)
refresh(usersModule)
}
else if(!confirm("User not found in log.\nDo you want to continue with deletion?")){
return
}*/
loadDirectory()
ensureUserRecordLoaded(u)
string error = deleteUser(u)
saveDirectory()
empty(lstUser)
getList()
if((null error)&&(!existsUser(uName))){
infoBox uName" has been deleted permanently."
}
else{
ack "User not deleted: " error
/*o."Active (T/F)" = "True"
o."Deletion Date" = ""
o."Reason" = ""
save(usersModule)
refresh(usersModule)*/
}
}
else {
ack"Abort Deletion"
halt
}
}
else {
ack"Abort Deletion"
halt
}
}
else {
infoBox"User Not found"
}
}
flushDeletions()
} // End Delete User
userInfo = create("Manage Users Tool - " dbName" v. 1.0", styleCentered|styleFixed)
lstUser = listView(userInfo, listViewOptionMultiselect|listViewOptionSortText, 625, 10, lstArray)
btnDeleteUser = button(userInfo, "Delete User", delUser)
realize(userInfo)
getList()
show(userInfo)
|
Re: First Time Run (Super Slow) Doug.Zawacki - Wed Oct 13 12:13:47 EDT 2010 Thank a lot. You make my day. |
Re: First Time Run (Super Slow) SystemAdmin - Thu Oct 14 13:01:36 EDT 2010 |